package com.smart.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smart.pojo.LeaveBill;
import com.smart.pojo.ResultBean;
import com.smart.req.PageData;
import com.smart.resp.LeaveBillResp;
import com.smart.service.ILeaveBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lyj
 * @since 2023-05-02
 */
@RestController
@RequestMapping("leave-bill")
public class LeaveBillController {
    @Autowired
    private ILeaveBillService leaveBillService;

    /**
     * 根据用户id获取请假单信息
     * @param userId
     * @param pageData
     * @return
     */
    @GetMapping("queryByUserId/{userId}")
    public ResultBean queryByUserId(@PathVariable("userId") Long userId, PageData pageData){
        System.out.println("获取请假单的用户ID：" + userId);
        Page page = new Page<>(pageData.getPageNum(),pageData.getPageSize());
        leaveBillService.queryPageByUserId(userId,page);
        return ResultBean.success(page);
    }

}
